package cn.charmaine.org.service.impl;

import cn.charmaine.basic.base.query.BaseQuery;
import cn.charmaine.basic.base.service.impl.BaseServiceImpl;
import cn.charmaine.basic.util.PageList;
import cn.charmaine.org.domain.SystemDictionaryType;
import cn.charmaine.org.mapper.ISystemDictionaryTypeMapper;
import cn.charmaine.org.service.ISystemDictionaryTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional(readOnly = true,propagation = Propagation.SUPPORTS)
public class SystemDictionaryTypeServiceImpl extends BaseServiceImpl<SystemDictionaryType> implements ISystemDictionaryTypeService {
    @Autowired
    private ISystemDictionaryTypeMapper systemDictionaryTypeMapper;

    @Override
    @Transactional
    public void add(SystemDictionaryType systemDictionaryType) {
        systemDictionaryTypeMapper.insert(systemDictionaryType);
    }

    @Override
    @Transactional
    public void deleteById(Long id) {
        systemDictionaryTypeMapper.deleteById(id);
    }

    @Override
    @Transactional
    public void update(SystemDictionaryType systemDictionaryType) {
        systemDictionaryTypeMapper.update(systemDictionaryType);
    }

    @Override
    public SystemDictionaryType queryById(Long id) {
        return systemDictionaryTypeMapper.selectById(id);
    }

    @Override
    public List<SystemDictionaryType> queryAll() {
        return systemDictionaryTypeMapper.selectAll();
    }

    @Override
    public PageList<SystemDictionaryType> queryData(BaseQuery query) {
        Long count = systemDictionaryTypeMapper.count(query);
        List<SystemDictionaryType> rows = systemDictionaryTypeMapper.rows(query);
        return new PageList<>(count,rows);
    }

    @Override
    @Transactional
    public void batchDelete(List<Long> ids) {
    }
}
